/*
* @Title: User/Login
* @Doc: 用户登录
* @param Email 邮件号码
* @param Password 密码
*/
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login([Bind(Include = "Email,Password")] LoginVO loginVO)
{
    User user = null;

    DbQuery<User> dbQuery = db.User.Where(u => u.Email == loginVO.Email) as DbQuery<User>;
    List<User> users = dbQuery.ToList();

    if (users != null && users.Count() > 0)
    {
        user = users[0];
    }

    return null;
}

/*
* @Title: Photo/Save
* @Doc: 用户添加图片
* @param CatalogId 目录ID
* @param Name 图片名字
* @param PhotoPath 图片存储路径
* @param Introduction 图片介绍
*/
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Save([Bind(Include = "CatalogId,Name,PhotoPath,Introduction")] PhotoVO photoVO)
{
    int result = db.AddPhotoToCatalog(photoVO.CatalogId, photoVO.Name, photoVO.PhotoPath, photoVO.Introduction, DateTime.Now, DateTime.Now);
    return null;
}

/*
* @Title: Catalog/Save
* @Doc: 用户添加目录
* @param UserId 用户ID
* @param Name 目录名字
* @param CoverPath 目录封面图路径
* @param Introduction 目录介绍
*/
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Save([Bind(Include = "UserId,Name,CoverPath,Introduction")] CatalogVO catalogVO)
{
    int result = db.AddCatalogToUser(catalogVO.UserId, catalogVO.Name, catalogVO.CoverPath, catalogVO.Introduction, DateTime.Now, DateTime.Now);
    return null;
}


// 未登录跳转
if (Session["id"] == null)
{
    return RedirectToAction("Login", "User");
}